package com.junit.demo.study01;

import static java.lang.String.valueOf;

public class GameNumber {
    private int rawNumber;
    public GameNumber(int rawNumber) {
        this.rawNumber = rawNumber;
    }

    public String say() {
        if(hasMatters(rawNumber,3) && hasMatters(rawNumber,5)){
            return "fizzbuzz";
        }
        if (hasMatters(rawNumber,3)){
            return "fizz";
        }
        if (hasMatters(rawNumber,5)){
            return "buzz";
        }
        return valueOf(rawNumber);
    }
    private boolean hasMatters(int src,int target){
        return src % target == 0 || valueOf(src).contains(valueOf(target));
    }
}
